package com.txsj.scan.utils.glide;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.txsj.scan.R;

import java.io.File;

/**
 * Created by wwb on 2016/10/18.
 * Glide 加载图片，操作工具类
 */

public class GlideImgManager {


    public static void getLoadImg(Context mContext, String imgUrl, ImageView imageView) {
        Glide.with(mContext)
                .load(imgUrl)
                .error(R.mipmap.icon_zhan)
                .placeholder(R.mipmap.icon_zhan)
                .into(imageView);
    }


    public static void getLoadCircleImg(Context mContext, String imgUrl, ImageView imageView) {
        Glide.with(mContext)
                .load(imgUrl)
                .error(R.mipmap.icon_zhan)
//                .placeholder(R.drawable.hend_img)
                .transform(new GlideCircleTransform(mContext))
                .into(imageView);
    }


    public static void getLoadCircleImg(Context mContext, int imgUrl, ImageView imageView) {
        Glide.with(mContext)
                .load(imgUrl)
                .error(R.mipmap.ic_launcher)
//                .placeholder(R.drawable.hend_img)
                .transform(new GlideCircleTransform(mContext))
                .into(imageView);
    }


    //加载本地的图片
    public static void getLoadCircleImgLocal(Context mContext, Integer imgUrl, ImageView imageView) {
        Glide.with(mContext)
                .load(imgUrl)
                .error(R.mipmap.icon_zhan)
//                .placeholder(R.drawable.hend_img)
                .transform(new GlideCircleTransform(mContext))
                .into(imageView);
    }

    //加载本地的图片
    public static void getLoadCircleImgBitmapLocal(Context mContext, File imgUrl, ImageView imageView) {
        Glide.with(mContext)
                .load(imgUrl)
                .error(R.mipmap.icon_zhan)
//                .placeholder(R.drawable.hend_img)
                .transform(new GlideCircleTransform(mContext))
                .into(imageView);
    }

    public static void getLoadRoundImg(Context mContext, String imgUrl, ImageView imageView) {
        Glide.with(mContext)
                .load(imgUrl)
                .error(R.mipmap.icon_zhan)
                .placeholder(R.mipmap.icon_zhan)
                .transform(new GlideRoundTransform(mContext))
                .into(imageView);
    }


}
